import Base from "./Base"

type Point = [number, number]

export default class extends Base {
  points: Point[]
  size: number = 5
  fillStyle = 'white'
  constructor(points: Point[], size: number,fillStyle = 'white') {
    super()
    this.points = points
    this.size = size
    this.fillStyle = fillStyle
  }
  draw(ctx: CanvasRenderingContext2D, osCtx: OffscreenCanvasRenderingContext2D) {
    ctx.save()
    ctx.beginPath()
    ctx.fillStyle = this.fillStyle
    for (let i = 0; i < this.points.length; i++) {
      const [x, y] = this.points[i];
      ctx.moveTo(x, y)
      ctx.arc(x, y, this.size, 0, Math.PI * 2)
    }
    ctx.closePath()
    ctx.fill()
    ctx.restore()
  }
}